<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<style type="text/css">
			* {
				padding: 0;
				margin: 0;
			}
			
			td {
				background: black;
				border: 1px solid gray;
			}
			
			.active {
				background-color: white;
			}
			
			#bgm {
				width: 200px;
				height: 150px;
				border: 1px solid black;
				background-color: blue;
				border-radius: 10px;
				text-align: center;
				color: yellow;		
				position: absolute;
				left: 100px;
				top: 100px;
				display: none;
				
			}
			
			#bgm p {
				line-height: 100px;
			}
		</style>
	</head>

	<body>
		<div id="bgm">
			<h3>提示</h3>
			<p>游戏过关</p>
			<input type="button" id="" value="关闭" onclick="this.parentNode.style.display='none'" />
		</div>
		<table width="400" height="400" border="1" cellspacing="0" cellpadding="1">
			<tr>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
			</tr>
			<tr>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
			</tr>
			<tr>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
			</tr>
			<tr>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
			</tr>
		</table>
		<script type="text/javascript">
			var tds = document.getElementsByTagName("td");
			for(var i = 0; i < tds.length; i++) {
				tds[i].onclick = function() {
					var x = this.parentNode.rowIndex;
					var y = this.cellIndex;

					for(var t = 0; t < tds.length; t++) {
						var t_x = tds[t].parentNode.rowIndex;
						var t_y = tds[t].cellIndex;
						if(t_x == x || t_y == y) {
							if(tds[t].className == "active") {
								tds[t].removeAttribute("class");
							} else {
								tds[t].className = "active";
							}
						}
					}
					var isOpenAll = true;
					for(var k = 0; k < tds.length; k++) {
						if(tds[k].className != "active") {
						isOpenAll = false;
							break;
						}
					}
					if(isOpenAll) {
						document.getElementById("bgm").style.display = "block";
					}
				}
			}
			function guoguan (x) {
				
			}
		</script>
	</body>

</html>